package internal

import (
	"v8s-api/rest-api/target/generated-sources"
	resourcename "v8s/resource-name"

	"github.com/google/uuid"
)

type (
	ProjectID string
	TaskID    string
)

func ParseResourceNameFromAPI(name generated.ResourceName) (resourcename.ResourceName, error) {
	return resourcename.ParseResourceName(string(name))
}

func GenerateTaskID() TaskID {
	return TaskID(uuid.New().String())
}

func ParseProjectIDFromAPI(id generated.ProjectId) ProjectID {
	return ProjectID(id)
}

func ToAPI(rn resourcename.ResourceName) generated.ResourceName {
	return generated.ResourceName(rn.String())
}
